package com.example.index.controller;

import com.example.index.entity.Profession;
import com.example.index.service.ProfessionService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class CourseController {

    /**
     * 服务对象
     */
    @Resource
    private ProfessionService professionService;

    @GetMapping("course")
    public String course(ModelMap modelMap) {
        Page<Profession> professions = professionService.queryByPage(new Profession(), PageRequest.of(0, 1000));
        List<Profession> professionList = professions.getContent();
//        System.out.println(professionList);
        modelMap.addAttribute("professionList",professionList);
        return "course";
    }
}
